from logging import Logger

from nicegui import ui

from DefaultParams import DefaultParams
from ErrorParams import ErrorParams
from ThresholdParams import ThresholdParams


class ErrorParamsCtl:
    def __init__(self, logger: Logger):
        self.logger = logger

    def build_ui(self, error_params: ErrorParams):
        ui.label(f'Version:{error_params.version}').classes('text-bold')
        if error_params.code != 0x0000:
            ui.label(f'error code={error_params.code}')
            ui.label(f'error message={error_params.errmsg}')
        self.logger.debug('ErrorParamsCtl build_ui')
